package com.quasar.hpatient.module.doctor_detail;

import android.view.View;

import com.quasar.hpatient.R;
import com.quasar.hpatient.dialog.ChatDialog;

import lib.quasar.base.frame.BaseActivity;

/**
 * description: 健康档案
 * created by kalu on 2018/3/27 14:47
 */
public class DoctorDetailActivity extends BaseActivity<DoctorDetailPresenter> implements DoctorDetailView {

    public final static String DOCTOR_ID = "DOCTOR_ID";

    @Override
    public int initView() {
        return R.layout.activity_doctor_detail;
    }

    @Override
    public void initDataLocal() {

        findViewById(R.id.activity_mydoctor_detail_back).setOnClickListener(v -> onBackPressed());
        findViewById(R.id.activity_doctor_detail_apply).setOnClickListener(v -> showChat());
    }

    @Override
    public void initDataNet() {

        final View root = findViewById(R.id.activity_doctor_detail);
        getPresenter().detailInfo(this, root);
    }

    @Override
    public void showChat() {

        final ChatDialog dialog = new ChatDialog(this);
        dialog.setOnDialogChangeListener(input -> {
            final long doctorid = getIntent().getLongExtra(DOCTOR_ID, -1);
            getPresenter().applyMessage(DoctorDetailActivity.this, doctorid);
        });
        dialog.show();
    }
}